package com.xmx.ndmallwxapi.feign.factory;


import com.xmx.common.utils.R;
import com.xmx.ndmallwxapi.feign.CouponFeignClient;
import com.xmx.ndmallwxapi.feign.ProductFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2021/8/11 11:30
 */
@Component
public class CouponFallbackFatory implements FallbackFactory<CouponFeignClient> {

    @Override
    public CouponFeignClient create(Throwable throwable) {
        return new CouponFeignClient() {
            @Override
            public R listcoupon(Map<String, Object> params) {
                Map map = new HashMap();
                map.put("page","id:0000,msg:请求失败,error:"+ throwable.getMessage());
                return R.ok(map) ;
            }

            @Override
            public R infocoupon(Integer id) {
                return null;
            }

            @Override
            public R getcount(Integer id) {
                Map map = new HashMap();
                map.put("page","id:0000,msg:请求失败,error:"+ throwable.getMessage());
                return R.ok(map) ;
            }

            @Override
            public R getlistbyuid(Integer id) {
                Map map = new HashMap();
                map.put("page","id:0000,msg:请求失败,error:"+ throwable.getMessage());
                return R.ok(map) ;
            }

            @Override
            public R infoUsercoupon(Integer id) {
                Map map = new HashMap();
                map.put("page","id:0000,msg:请求失败,error:"+ throwable.getMessage());
                return R.ok(map) ;
            }

            @Override
            public R updateCouponUser(Map couponUser) {
                return null;
            }
        };
    }
}
